<?php /* Smarty version 2.6.20, created on 2012-07-29 03:30:17
         compiled from change_pwd.html */ ?>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="js/jquery.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="css/validator.css"></link>
<script src="js/formValidator.js" type="text/javascript"></script>
<script src="js/formValidatorRegex.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EEF2FB;
}
-->
</style>
<script type="text/javascript">
//CharMode函数
//测试某个字符是属于哪一类.
function CharMode(iN){
if (iN>=48 && iN <=57) //数字
return 1;
if (iN>=65 && iN <=90) //大写字母
return 2;
if (iN>=97 && iN <=122) //小写
return 4;
else
return 8; //特殊字符
}
//bitTotal函数
//计算出当前密码当中一共有多少种模式
function bitTotal(num){
modes=0;
for (i=0;i<4;i++){
if (num & 1) modes++;
num>>>=1;
}
return modes;
}
//checkStrong函数
//返回密码的强度级别
function checkStrong(sPW){
if (sPW.length<=4)
return 0; //密码太短
Modes=0;
for (i=0;i<sPW.length;i++){
//测试每一个字符的类别并统计一共有多少种模式.
Modes|=CharMode(sPW.charCodeAt(i));
}
return bitTotal(Modes);
}
//pwStrength函数
//当用户放开键盘或密码输入框失去焦点时,根据不同的级别显示不同的颜色
function pwStrength(pwd){
O_color="#eeeeee";
L_color="#ffa0a0";
M_color="#ff9b3a";
H_color="#a5e09b";
if (pwd==null||pwd==''){
Lcolor=Mcolor=Hcolor=O_color;
}
else{
S_level=checkStrong(pwd);
switch(S_level) {
case 0:
Lcolor=Mcolor=Hcolor=O_color;
case 1:
Lcolor=L_color;
Mcolor=Hcolor=O_color;
break;
case 2:
Lcolor=Mcolor=M_color;
Hcolor=O_color;
break;
default:
Lcolor=Mcolor=Hcolor=H_color;
}
}
document.getElementById("strength_L").style.background=Lcolor;
document.getElementById("strength_M").style.background=Mcolor;
document.getElementById("strength_H").style.background=Hcolor;
return;
}
</script>
<script type="text/javascript">
	$(document).ready(
		function(){
			$.formValidator.initConfig({formid:"myForm",onerror:function(msg){alert(msg)},onsuccess:function(){return true;}});

			$("#oldpwd").formValidator({onshow:"Please enter the password",onfocus:"Please enter the password"})
		    .ajaxValidator({
			    type : "get",
				url : "pwd.php",
				datatype : "json",
				success : function(data){
		            if( data == "1" )
					{
		                return true;
					}
		            else
					{
		                return false;
					}
				},
				error: function(){alert("Server does not return data, the server may be busy, please try again.");},
				onerror : "Password is wrong, please re-enter.",
				onwait : "It is checking the legality of the user name, please wait ..."
			});
			$("#pwd2").formValidator({forcevalid:true,triggerevent:"change",onshow:"Please input the duplicate password.",onfocus:"Oh, the two passwords must be consistent.",oncorrect:"Consistent"}).inputValidator({min:1,empty:{leftempty:false,rightempty:false,emptyerror:"The symbol on both sides of the password can not be empty."},onerror:"Duplicate password can not be empty, please make sure yourself."}).compareValidator({desid:"pwd1",operateor:"=",onerror:"The passwords you input two times do not match, please make sure."});
		}
	)

	function queding(){
		var r=confirm('Whether to save the settings？');
		if(r!=true){
			return false;
		}
	}
</script>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt" style="text-indent:8px">Change PWD</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>

  <tr>
    <td valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9">
    <form name="myForm" id="myForm" enctype="multipart/form-data" action="change_pwd.php" method="post" >
     <table width="100%" border="0" cellspacing="0" cellpadding="0" >
	 <br>
     <tr  class="nowtable">
     <td class="left_bt2" style="padding-left:10px;">Change Password</td>
     </tr>

     <tr>
     <td width="32%" height="40px" bgcolor="#f2f2f2" class="left_txt" style="padding-left:20px;" align="left">
    The original password：<span style="padding-left:28px;"><input name="oldpwd" id="oldpwd" type="password" /><div id="oldpwdTip" style="width:250px"></div></span>
     </td>
     </tr>
     <tr>
     <td width="32%" height="40px" bgcolor="#f2f2f2" class="left_txt" style="padding-left:20px;" align="left">
    New password：<span style="padding-left:28px;"><input type="password" name="pwd1" id="pwd1" onKeyUp="pwStrength(this.value)" onBlur="pwStrength(this.value)"/></span>
     </td>
     </tr>
     <tr>
<td class="left_txt">
<div width="217" style="border:1px solid #CCC;display:inline; background:#f8f8f8;line-height:20px;">
<div  style="float:left; background:#f8f8f8;border-right:1px solid #CCCCCC; text-align:center; width:80px;" id="strength_L"><span class="STYLE1">Weak</span></div>
<div  style="float:left; background:#f8f8f8;border-right:1px solid #CCCCCC;text-align:center;  width:80px;" id="strength_M"><span class="STYLE2">Medium</span></div>
<div  style="float:left; background:#f8f8f8;text-align:center;  width:80px;" id="strength_H"><span class="STYLE3">Strong</span></div>
</div>  </td>
</tr>

     <tr>
     <td width="32%" height="40px" bgcolor="#f2f2f2" class="left_txt" style="padding-left:20px;" align="left">
     Confirm Password：<span style="padding-left:18px;"> <input type="password" name="pwd2" id="pwd2"/><div id="pwd2Tip"></div></span>
     </td>
     </tr>


     <tr><td align="left" height="50px"  style="padding-left:200px"><input type="submit" name="submit" value="提交"></td></tr>
     </table>
  </form>
    </td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
    <td background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17"></td>
    <td valign="bottom" background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>